'use strict';

/* var arr=[10,20,1,2];
arr.sort(function(x,y){
    if(x<y){
        return -1;

    }
    if(x>y){
        return 1;

    }
    return 0;
});   

console.log(arr);
*/

function create_count(x){
    x=x ||0;
    return {
        increament:function (){
            return x += 1;

        }
    }
}

let fn=create_count();
console.log(fn.increament());
console.log(fn.increament());
console.log(fn.increament());
console.log(fn.increament());
console.log(fn.increament());
console.log(fn.increament());



function gen_pow(n){
    return function(x){
        return Math.pow(x,n);
    }
}
let pow2=gen_pow(2);
let pow=gen_pow(3);

console.log(pow2(3));
console.log(pow3(3));